package com.dailywork.basepro.thread.container;

import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit;

public class WangMin implements Delayed {

    private String name;
    // ���֤
    private String id;
    // ��ֹʱ��
    private long endTime;
    // ����ʱ�乤����
    private TimeUnit timeUtil = TimeUnit.SECONDS;

    public WangMin(String name, String id, long endTime) {
        super();
        this.name = name;
        this.id = id;
        this.endTime = endTime;
    }

    public WangMin() {
        // TODO Auto-generated constructor stub
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public long getEndTime() {
        return endTime;
    }

    public void setEndTime(long endTime) {
        this.endTime = endTime;
    }

    // ��д����������,�Ƚ�
    @Override
    public int compareTo(Delayed delayed) {
        // TODO Auto-generated method stub
        WangMin w = (WangMin) delayed;
        return this.getDelay(this.timeUtil) - w.getDelay(this.timeUtil) > 0 ? 1 : 0;
    }

    // �����ж��Ƿ��˽�ֹʱ��(�������<=0,��˵�������»�ʱ��)
    @Override
    public long getDelay(TimeUnit unit) {
        // TODO Auto-generated method stub
        return endTime - System.currentTimeMillis();
    }
}
